#pragma once
#include "Head.h"
#include "windows.h"
//#include "SimpleGeometry.h"

namespace DX 
{
	class _declspec(dllexport) DirectX
	{
	private:
		WINDOW::WinDows& m_wnd;
		IDirect3D9* g_d3d;
		IDirect3DDevice9* g_d3dDevice;
		
		/*Geometry::Triangle* m_triangle;*/
	public:
		DirectX(WINDOW::WinDows& p_win);

		void Render();

		BOOL IsDepthFormatOk(D3DFORMAT DepthFormat, D3DFORMAT AdapterFormat, D3DFORMAT BackBufferFormat)
		{
			// Verify that the depth format exists
			HRESULT hr = g_d3d->CheckDeviceFormat(D3DADAPTER_DEFAULT,
												  D3DDEVTYPE_HAL,
												  AdapterFormat,
												  D3DUSAGE_DEPTHSTENCIL,
												  D3DRTYPE_SURFACE,
												  DepthFormat);
			if(FAILED(hr)) return FALSE;
			// Verify that the depth format is compatible
			hr = g_d3d->CheckDepthStencilMatch(D3DADAPTER_DEFAULT,
											   D3DDEVTYPE_HAL,
											   AdapterFormat,
											   BackBufferFormat,
											   DepthFormat);
			return SUCCEEDED(hr);
		}

		IDirect3DDevice9* GetDevice(){ return g_d3dDevice; }
	};
}